package com.power.leopard.util;

import com.power.leopard.constants.Constants;
import com.power.leopard.remote.common.codec.SerializerFactory;
import com.power.leopard.remote.common.domain.InvocationRequest;
import com.power.leopard.remote.common.domain.InvocationResponse;

public class ProviderUtils {

	public static InvocationResponse createSuccessResponse(InvocationRequest request, Object returnObj) {
		InvocationResponse response = null;
		byte serialize = request.getSerialize();
		response = SerializerFactory.getSerializer(serialize).newResponse();
		response.setSequence(request.getSequence());
		response.setSerialize(serialize);
		response.setMessageType(Constants.MESSAGE_TYPE_SERVICE);
		response.setReturn(returnObj);

		return response;
	}
}
